package com.ts.api.module.match.plan.internal.selection;

import com.ts.api.module.match.plan.internal.distribute.model.PlanDistributeResult;
import com.ts.api.module.match.plan.internal.selection.context.PostPlanSelectionContext;
import com.ts.api.module.match.plan.internal.selection.context.PostPlanSelectionType;
import com.ts.api.module.match.plan.internal.selection.strategy.PlanSelection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 *  计划结果选择处理器
 *
 *  @author Pan
 */
@Component
public class PostPlanSelector {

    @Autowired
    private PostPlanSelectionContext postPlanSelectionContext;

    /**
     *  匹配后-结果选择处理
     *
     *  @author Pan
     *  @param  listSucMatchResult       返回成功匹配结果
     *  @param  postPlanSelectionType    计划选择结果枚举
     *  @return PlanDistributeResult
     */
    public PlanDistributeResult select(List<PlanDistributeResult> listSucMatchResult, PostPlanSelectionType postPlanSelectionType) {
        PlanSelection context = postPlanSelectionContext.getContext(postPlanSelectionType);
        return context.select(listSucMatchResult);
    }
}
